import 'package:flutter/material.dart';
import 'package:homepad/styles.dart';

class SettingItemDetail extends StatelessWidget {
  final String icon;
  final String title;
  final String subtitle;
  final GestureTapCallback? onPressed;
  final Widget? customIcon;

  const SettingItemDetail(this.icon,
      { super.key,
        required this.title,
        required this.subtitle,
        this.onPressed,
        this.customIcon,
      });

  @override
  Widget build(BuildContext context) {
    final MyStyles styles = Theme.of(context).extension<MyStyles>()!;
    return SizedBox(
        width: 200,
        height: 65,
        child: InkWell(
          onTap: onPressed,
          child: Stack(
            children: [
              const Image(
                  fit: BoxFit.fill,
                  image: AssetImage("assets/images/bg_icon_setting_item.jpg")),
              Positioned(
                  left: 0,
                  child: customIcon ?? Image(
                    height: 65,
                    image: AssetImage("assets/images/$icon.png"),
                  )),
              Positioned(
                  left: 75, top: 6,
                  child: Text(title, style: styles.titleStyle.copyWith(
                    letterSpacing: 0.35,
                  )
              )),
              Positioned(
                  left: 75,
                  bottom: 6,
                  child: Text(subtitle, style: styles.textStyle))
            ],
          ),
        ));
  }
}
